<?php
  session_start();
  if (isset($_SESSION['client'])) {
    $client = $_SESSION['client'];      
  } else {
    session_destroy();
    header("Location: /buscaesbirros/index.php");
  }
  require_once("functions.php");
  require_once("header.php"); 
  require_once("maps/GoogleMap.php");
  require_once("maps/JSMin.php");

  $MAP_OBJECT = new GoogleMapAPI();
  $MAP_OBJECT->_minify_js = isset($_REQUEST["min"])?FALSE:TRUE;
?>
<div class="container">
  <div class="hero-unit">
    <div class="row-fluid">
      <div class="span12">
        <form action="" method="POST" class="navbar-search pull-left">
          <input type="text" name="lugar" placeholder="Dirección a buscar" class="search-query"/>
        </form>
      </div>
    </div>
    <hr />
    <div class="row-fluid">
      <div class="span12">
        <?php
          if (isset($_POST['lugar'])) {
            echo '<span class="label label-info">Ubicación del cliente</span> ' . ucfirst($_POST['lugar']);
            $MAP_OBJECT->addMarkerByAddress($_POST['lugar'], "Cliente", $_POST['lugar'], '/buscaesbirros/img/star.png', '/buscaesbirros/img/star.png' );
          }
          pintaCoordenadas($MAP_OBJECT);
          echo $MAP_OBJECT->getHeaderJS();
          echo $MAP_OBJECT->getMapJS();

          echo $MAP_OBJECT->printOnLoad();
          echo $MAP_OBJECT->printMap();
        ?>
      </div>
    </div>  
</div>
</div>
<?php require_once("footer.php") ?>